{% extends 'ahp/base.html' %}
{% block content %}
    <h4>输入当前场景的试验指标数据</h4>
    <form method="POST" enctype="multipart/form-data">{% csrf_token %}
{#                {{ form.as_p }}#}
        {% for field in form %}
            <div class="fieldWrapper">
                {{ field.errors }}
                {% if forloop.counter0 == 0 %}场景名称:{% endif %}
                {% if forloop.counter0 == 1 %}{{ criteria.get_fields.0.1 }}:{% endif %}
                {% if forloop.counter0 == 2 %}{{ criteria.get_fields.1.1 }}:{% endif %}
                {% if forloop.counter0 == 3 %}{{ criteria.get_fields.2.1 }}:{% endif %}
                {% if forloop.counter0 == 4 %}图片资源:{% endif %}
                {{ field }}
                {% if field.help_text %}
                    <p class="help">{{ field.help_text|safe }}</p>
                {% endif %}
            </div>
        {% endfor %}
    <div class="center-container">
        <button type="submit">保存</button>
        <a href="{% url 'crit_model_details' pk=pk %}"><button type="button">返回</button></a>
    </div>
    </form>
    <hr>
    <h4>已有场景列表</h4>
               {% for element in elements %}
                        <div class="attributes">
                 <a href="{% url 'modify_elements' pk=pk e_id=element.pk%}"><div class="image">
                    {% for field, value in element.get_fields %}
                        {% if field == "image" %}
                            <img class="element" src="/media/{{ value }}" alt="{{ value }}">
                        {% endif %}
                    {% endfor %}
                </div>
                 </a>
                <ul class="description">
                    {% for field, value in element.get_fields %}
                        {% if field != "image" %}
                            <li>{{ field }} : {{ value }}</li>
                        {% endif %}
                    {% endfor %}
                </ul>
                        </div>
            {% endfor %}

{% endblock %}